load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "memo",
    srcs = [
        "expr_iterator.go",
        "group.go",
        "group_expr.go",
        "implementation.go",
        "pattern.go",
    ],
    importpath = "github.com/pingcap/tidb/pkg/planner/memo",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/expression",
        "//pkg/planner/core",
        "//pkg/planner/property",
    ],
)

go_test(
    name = "memo_test",
    timeout = "short",
    srcs = [
        "expr_iterator_test.go",
        "group_expr_test.go",
        "group_test.go",
        "main_test.go",
        "pattern_test.go",
    ],
    embed = [":memo"],
    flaky = True,
    shard_count = 22,
    deps = [
        "//pkg/domain",
        "//pkg/expression",
        "//pkg/infoschema",
        "//pkg/parser",
        "//pkg/parser/model",
        "//pkg/planner/core",
        "//pkg/planner/property",
        "//pkg/sessionctx/variable",
        "//pkg/testkit/testsetup",
        "@com_github_stretchr_testify//require",
        "@io_opencensus_go//stats/view",
        "@org_uber_go_goleak//:goleak",
    ],
)
